package com.woniuxy.mybatisstudy.constant;

/**
 * @Author: linKe
 * @Date: 2022/1/14 16:15
 * @FileName: AArticleEnum
 * @version: 1.0
 * @Description: 文章类型枚举类
 */
public enum ArticleTypeEnum {
    /**
     * JAVA
     */
    JAVA(1),
    /**
     * DUBBO
     */
    DUBBO(2),
    /**
     * SPRING
     */
    SPRING(4),
    /**
     * MYBATIS
     */
    MYBATIS(8);
    /**
     * 编码值
     */
    private int code;

    ArticleTypeEnum(int code) {
        this.code = code;
    }

    public int code() {
        return code;
    }

    public static ArticleTypeEnum find(int code) {
        for (ArticleTypeEnum at : ArticleTypeEnum.values()) {
            if (at.code == code) {
                return at;
            }
        }

        return null;
    }
}
